package com.xpgk.mvc.budgetMonth;

import java.util.List;
import java.util.Map;

import com.jfinal.aop.Before;
import com.jfinal.plugin.activerecord.tx.Tx;
import com.xpgk.mvc.base.BaseController;
import com.xpgk.mvc.codeSet.Code;
import com.xpgk.mvc.productSet.Product;

public class BudgetMonthController extends  BaseController{
		
	private  BudgetMonthService  budgetMonthService;
	
		public void index() {
			render("budgetMonth.html");
		}
		
		public  void  getPro()
		{
			String sql=getSqlMy(Product.sqlId_nolcpro);
			List<Product> proList=Product.dao.find(sql,Code.lc_ids);
			renderJson(proList);
		}
		
		
		/**获取月度预算产品信息
		 * 
		 */
		public  void  getBudgetMonth()
		{
			List<Map>  budgetMonthList=	budgetMonthService.getBudgetMonth(getCUserOrganIds());
			renderJson(budgetMonthList);
		}
		/**保存月度预算
		 * 
		 */
		@Before(Tx.class)
		public  void  saveBudget()
		{
			String  budgetJson=getPara("budgetJson");
			String  msg=budgetMonthService.saveBudget(budgetJson,getCUserOrganIds(),getCUserIds());
			renderText(msg);
		}
		
}
